jQuery.extend({
	handleError : function(s, xhr, status, e) {
		// If a local callback was specified, fire it
		if (s.error)
			s.error(xhr, status, e);
		// If we have some XML response text (e.g. from an AJAX call) then log
		// it in the console
		else if (xhr.responseText)
			console.log(xhr.responseText);
	}
});

function templateUpload(){
	var templateType = $('#templateType').val();
    $.ajaxFileUpload({
        url: '/template/upload?templateType='+templateType,
        secureuri: false,
        fileElementId: 'img',
        dataType: 'json',
        success: function (data,status) {
            if(data.flag==0){
            	alert("上传成功");
            }else{
            	alert(data.msg);
            }
        },
        error: function (data,status) {
            if(data.flag==0){
            	alert("上传成功");
            }else{
            	alert(data.msg);
            }
        }
    });
}